﻿<div style="color:Black;background-color:White;"><pre>
<span style="background-color:Yellow;">&lt;%</span><span style="color:Blue;">@</span> <span style="color:#A31515;">Application</span> <span style="color:Red;">Language</span><span style="color:Blue;">=</span><span style="color:Blue;">&quot;C#&quot;</span> <span style="color:Red;">CodeBehind</span><span style="color:Blue;">=</span><span style="color:Blue;">&quot;Global.asax.cs&quot;</span> <span style="color:Red;">Inherits</span><span style="color:Blue;">=</span><span style="color:Blue;">&quot;Microsoft.Foundation.Web.Global&quot;</span> <span style="background-color:Yellow;">%&gt;</span>
<span style="color:Blue;">&lt;</span><span style="color:#A31515;">script</span> <span style="color:Red;">runat</span><span style="color:Blue;">=</span><span style="color:Blue;">&quot;server&quot;</span><span style="color:Blue;">&gt;</span>
<span style="color:Blue;">using</span> System.IO;
<span style="color:Blue;">using</span> System.Text;
<span style="color:Blue;">using</span> System.Web;
<span style="color:Blue;">using</span> CodePlex.Common;
<span style="color:Blue;">using</span> CodePlex.Presentation.Compression;
<span style="color:Blue;">using</span> CodePlex.Presentation.Css.Presenter;
<span style="color:Blue;">using</span> CodePlex.Presentation.Navigation;

<span style="color:Blue;">namespace</span> CodePlex.WebSite.Css
{
    <span style="color:Gray;">///</span> <span style="color:Gray;">&lt;summary&gt;</span>
    <span style="color:Gray;">///</span><span style="color:Green;"> StyleSheet.ashx parses and delivers css files submitted through the QueryString</span>
    <span style="color:Gray;">///</span><span style="color:Green;"> It replaces constants described by the css file in the form </span>
    <span style="color:Gray;">///</span><span style="color:Green;"> </span>
    <span style="color:Gray;">///</span><span style="color:Green;">     /*{css:ConstantName}*/</span>
    <span style="color:Gray;">///</span><span style="color:Green;"> </span>
    <span style="color:Gray;">///</span><span style="color:Green;"> with the correspondingly named AppSetting Key from the containing directory's .config file</span>
    <span style="color:Gray;">///</span> <span style="color:Gray;">&lt;/summary&gt;</span>
    <span style="color:Blue;">public</span> <span style="color:Blue;">class</span> StyleSheet : IHttpHandler
    {
        <span style="color:Blue;">public</span> <span style="color:Blue;">void</span> ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = <span style="color:#A31515;">&quot;text/css&quot;</span>;
            <span style="color:Blue;">if</span> (context.Request.QueryString[<span style="color:#A31515;">&quot;i&quot;</span>] == <span style="color:Blue;">null</span>)
                <span style="color:Blue;">return</span>;

            <span style="color:Blue;">string</span>[] cssFiles;
            cssFiles = css.ToString().Split(<span style="color:#A31515;">','</span>);
            <span style="color:Blue;">for</span> (<span style="color:Blue;">int</span> i = 0; i &lt; cssFiles.Length; i++)
            {
                cssFiles[i] = Path.GetFileName(cssFiles[i].Trim());
                <span style="color:Blue;">if</span> (!Path.HasExtension(cssFiles[i]))
                    cssFiles[i] = Path.ChangeExtension(cssFiles[i], <span style="color:#A31515;">&quot;.css&quot;</span>);
            }

            <span style="color:Green;">//Cache settings handled in AddHeaderItemsToRequestModule</span>
            <span style="color:Green;">//bool alreadyCached;</span>
            <span style="color:Green;">//CompressionUtility.SetCaching(context, cssFiles, out alreadyCached);</span>
            <span style="color:Green;">//if (alreadyCached)</span>
            <span style="color:Green;">//    return;</span>
        }

        <span style="color:Blue;">public</span> <span style="color:Blue;">bool</span> IsReusable
        {
            <span style="color:Blue;">get</span> { <span style="color:Blue;">return</span> <span style="color:Blue;">false</span>; }
        }
    }
}
<span style="color:Blue;">&lt;/</span><span style="color:#A31515;">script</span><span style="color:Blue;">&gt;</span>
</pre></div>